const Sequelize = require("sequelize");
const db = require('../DBConfig/config');

const UserList = db.define('user', {
    id: {
        type: Sequelize.INTEGER(11),
        allowNull: false,
        primaryKey: true,
        autoIncrement: true
    },
    username: {
        type: Sequelize.TEXT,
        allowNull: true
    },
    password: {
        type: Sequelize.TEXT,
        allowNull: true
    },
    sex: {
        type: Sequelize.TEXT,
        allowNull: true
    },
    phone: {
        type: Sequelize.CHAR,
        allowNull: true
    },
    status: {
        type: Sequelize.TINYINT
    },
    openid: {
        type: Sequelize.TEXT
    },
    sessionKey: {
        type: Sequelize.TEXT
    },
    create_time: {
        type: Sequelize.DATE
    },
    avatar: {
        type: Sequelize.TEXT
    },
    user_type: {
        type: Sequelize.INTEGER(11)
    }
}, {
    freezeTableName: true,
    timestamps: false
})

// UserList.hasOne(, { foreignKey: 'openid', as: 'info' })

module.exports = UserList;